import { createApp } from 'vue'
import App from '@/App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
//@ts-ignore
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'virtual:svg-icons-register'
import GlobalComponent from '@/components/index.ts'
import '@/styles/index.scss'
import router from './router'
import pinia from './store'
import '@/permission'
import permission from '@/directive/permission'
import 'element-plus/theme-chalk/dark/css-vars.css'
const app = createApp(App)
app.use(ElementPlus, {
  locale: zhCn,
})
pinia.use(({ store }) => {
  const initialState = JSON.parse(JSON.stringify(store.$state))
  store.$reset = () => {
    store.$patch(initialState)
  }
})
permission(app)
app.use(router)
app.use(pinia)
app.use(GlobalComponent)
app.mount('#app')
